package com.morningstar.flow.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.morningstar.common.dao.entity.BaseEntity;
import com.morningstar.flow.controller.result.FlowTask;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 流程实列信息
 */
@Setter
@Getter
@TableName(value = "flow_instance", autoResultMap = true)
public class FlowInstance extends BaseEntity {
    /**
     * 流程实列Id
     */
    @TableId(value = "instance_id", type = IdType.ASSIGN_ID)
    private Long instanceId;
    /**
     * 流程Id
     */
    @TableField("process_id")
    private Long processId;
    /**
     * 流程实列编号
     */
    @TableField("process_instance_id")
    private String processInstanceId;
    /**
     * 流程业务编号
     */
    @TableField("biz_number")
    private String bizNumber;
    /**
     * 流程表单数据
     */
    @TableField(value = "form_model", typeHandler = JacksonTypeHandler.class)
    private Object formModel;
    /**
     * 流程发起人
     */
    @TableField("start_user_id")
    private Long startUserId;
    /**
     * 流程状态
     */
    @TableField("status")
    private String status;
    /**
     * 流程结束时间
     */
    @TableField("end_time")
    private LocalDateTime endTime;


    /**
     * 流程名称
     */
    @TableField(exist = false)
    private String processName;

    /**
     * 流程发起人
     */
    @TableField(exist = false)
    private String startUserName;

    /**
     * 当前进行的任务列表
     */
    @TableField(exist = false)
    private List<FlowTask> flowTaskList;

    /**
     * 流程信息
     */
    @TableField(exist = false)
    private FlowProcess flowProcess;
}
